package com.yanxin.grpc.stub.service;

import com.yanxin.grpc.proto.hello.HelloReply;
import com.yanxin.grpc.proto.hello.HelloRequest;
import com.yanxin.grpc.proto.hello.SimpleGrpc;
import net.devh.boot.grpc.client.inject.GrpcClient;
import org.springframework.stereotype.Service;

@Service
public class HelloService {

    @GrpcClient("simpleClientService")
    private SimpleGrpc.SimpleBlockingStub simpleBlockingStub;

    public void getMessage(){
        HelloReply helloReply = simpleBlockingStub.sayHello(HelloRequest.newBuilder()
                .setName("lanlan")
                .build());
        System.out.println(helloReply.getMessage());
    }
}
